package com.example.life;

public class DreadDiseaseInsurance {
    public String applicant;
    public double insuredAmount;
    public String insurant;

    public DreadDiseaseInsurance(String applicant,
                                        double insuredAmount, String insurant){
        this.applicant = applicant;
        this.insuredAmount = insuredAmount;
        this.insurant = insurant;
    }

    public String printPolicy() {

        StringBuilder output = new StringBuilder();
        double expenses = 0d;

        if (insurant.equals("son")){
            expenses = 3090;
        } else if (insurant.equals("daughter")){
            expenses = 2970;
        }
        // print headers
        output.append("======Printing Policy======\n");
        output.append("Product: ").append("Dread Disease Insurance").append('\n');
        output.append("Applicant: ").append(applicant).append('\n');
        output.append("Insured Amount: ").append(insuredAmount).append('\n');
        output.append("Insurant: ").append(insurant).append('\n');
        output.append("Expenses: ").append(expenses).append('\n');
        output.append("======Printing End=========\n");

        return output.toString();
    }
}
